<template xmlns='http://www.w3.org/1999/html'>
  <div class='oaFeeapply' style='padding: 11px'>
    <a-spin :spinning='confirmLoading'>
      <a-form :form='form'>
        <a-row :gutter='24'>
          <a-col :md='8' :sm='24'>
            <a-form-item label='活动名称' :labelCol='labelCol' :wrapperCol='wrapperCol'>
              <a-input :readOnly='true' placeholder='请输入活动名称'
                       v-decorator="['actName', validatorRules.actName]" />
            </a-form-item>
          </a-col>
          <a-col :md='8' :sm='24'>
            <a-form-item
              :labelCol='labelCol'
              :wrapperCol='wrapperCol'
              label='活动时间'
              >
              <a-range-picker :readOnly='true' format='YYYY-MM-DD' :disabledDate='disabledDate'
                              v-decorator="['rangDate',validatorRules.rangDate]" />
            </a-form-item>
          </a-col>
          <a-col :md='8' :sm='24'>
            <a-form-item
              :labelCol='labelCol'
              :wrapperCol='wrapperCol'
              label='备注'
              >
              <a-input :readOnly='true' placeholder='请输入备注'
                       v-decorator="['remarks', validatorRules.remarks]" />
            </a-form-item>
          </a-col>
          <a-col :md='24' :sm='24'>
            <div class='basicNew1'>预算信息
            </div>
          </a-col>
          <a-col :md='24' :sm='24'>
            <a-table
              ref='table'
              size='middle'
              bordered
              rowKey='id'
              :scroll='{ x: 2000 }'
              :columns='columns'
              :dataSource='dataSource1'
              :pagination='false'
              :loading='loading'
            >
              <template slot='amount' slot-scope='text, record,index'>
                <span>{{ text }}</span>
              </template>
            </a-table>

          </a-col>
          <a-col :md='24' :sm='24'>
            <div class='basicNew1'>活动模板
            </div>
          </a-col>
          <a-col :md='24' :sm='24'>
            <div class='chooseActive'>
              <div style='font-weight: 700'>基本信息</div>
              <div style='display: flex;border-bottom: 1px solid #dfdede'>
                <div style='width: 200px'>活动模板:{{ templateData.templateName }}</div>
                <div style='width: 100%;'>
                  <a-col :md='8' :sm='24'>
                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='渠道类型'
                      >
                      <a-input :readOnly='true' placeholder='请输入活动名称'
                               v-decorator="['channelName', validatorRules.actName]" />
                    </a-form-item>
                  </a-col>
                  <a-col :md='8' v-if='visible' :sm='24'>
                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='组织'
                      >
                      <a-input :readOnly='true' v-decorator="['actOrgName']"></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md='8' :sm='24'>
                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='参与经销商'
                    >
                      <a-input :readOnly='true' v-decorator="['custName']"></a-input>
                    </a-form-item>
                  </a-col>
                  <a-col :md='8' :sm='24' v-if='templateData.actScopeType == 3'>

                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='参与终端'>
                      <div style='flex'>
                        <a-button v-if='!disableSubmit' :disabled='!this.form.getFieldValue("custCode")' type='primary'
                                  @click='userlist'>添加终端
                        </a-button>
                        <a-button v-if='disableSubmit' type='primary' @click='watchTerminal'>查看终端
                        </a-button>
                      </div>
                    </a-form-item>
                  </a-col>
                  <a-col :md='8' :sm='24'>
                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='预估销量'
                      >
                      <a-input :readOnly='true' style='width: 100%' placeholder='预估销量' suffix='吨'
                               v-decorator="['predictSaleNum', validatorRules.predictSaleNum]" />
                    </a-form-item>
                  </a-col>
                  <a-col :md='8' :sm='24'>
                    <a-form-item
                      :labelCol='labelCol1'
                      :wrapperCol='wrapperCol1'
                      label='活动详情附件'>
                      <a-button @click='handleEdit' type='primary'>点击查看</a-button>
                    </a-form-item>
                  </a-col>

                </div>
              </div>
            </div>
            <div class='chooseActive1'>
              <div class='choose-left'>
                <a-spin :spinning='aTabsLoading'>
                  <a-tabs>
                    <a-tab-pane v-for='(item,i) in actDetails' :key='item.id'
                                :tab='item.categoriesDetailName'>
                      <a-card class='tab-card'>
                        <div v-for='(items,num) in item.detailAmounts' :key='num'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='预算编码'
                              :required='true'
                              >
                              <a-input placeholder='请输入预算编码'
                                       :disabled='true'
                                       v-model='items.budgetCode'
                              />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='申请金额'
                              :required='true'
                              >
                              <a-input :readOnly='true' placeholder='请输入申请金额'
                                       @change='e =>  moneyTotal(e,items)'
                                       v-model='items.applyAmount'

                              />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='配置费比'
                              :required='true'
                            >
                              <a-input suffix='%' readOnly type='number' :min='0' v-model='items.detailedCostRatio' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='累计费比'
                              :required='true'
                            >
                              <div style='width: 100%;position: relative'>
                                <a-input readOnly type='number' :min='0' v-model='items.cumulativeCostRatio'
                                         :style="{color:items.cumulativeCostRatio>items.detailedCostRatio?'red':''}" />
                                <span style='position: absolute;right: 10px;top: 0px'>%</span>
                              </div>
                              <!--                              items.cumulativeCostRatio>items.detailedCostRatio?'color: red':''"-->

                            </a-form-item>
                          </a-col>
                        </div>
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 1'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='陈列形式'
                              >
                              <a-input :readOnly='true' v-model='item.displayFormStr' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='陈列位置'
                              >
                              <a-input :readOnly='true' placeholder='请输入陈列位置' v-model='item.displayPosition' />
                            </a-form-item>
                          </a-col>
                          <a-col :md='23' :sm='24'>
                            <a-form-item
                              :labelCol='{xs:4,xm:24}'
                              :wrapperCol='{xs:20,xm:24}'
                              :required='true'
                              label='陈列商品'
                              >
                              <a-input :readOnly='true' v-model='item.displayProductName' />
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--                      人员费-->
                        <!--                      <div>-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 3'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='人员性质'
                              :required='true'
                              >
                              <a-input :readOnly='true' v-model='item.manNatureStr' />
                              <!--                              <j-multi-select-tag-->
                              <!--                                :readOnly='true'-->
                              <!--                                v-model='item.manNature'-->
                              <!--                                dictCode='person_point'-->
                              <!--                                type='select'>-->
                              <!--                              </j-multi-select-tag>-->
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='人数'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入人数'
                                       v-model='item.num' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='日工资'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入日工资'
                                       v-model='item.dailyWage' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='聘用天数'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入聘用天数'
                                       v-model='item.employDay' />
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--                      </div>-->
                        <!--                      样品费-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 4'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='商品层级'
                              :required='true'
                              >
                              <!--                              <j-tree-select-->
                              <!--                                :readOnly='true'-->
                              <!--                                v-model='item.productLevelName'-->
                              <!--                                placeholder='请选择商品层级'-->
                              <!--                                data-type='product_type'-->
                              <!--                                @change='(e,v)=>changeJselect(e,v,i,"productLevelName","productLevelCode")'-->
                              <!--                              />-->
                              <a-input :readOnly='true' v-model='item.productLevelName'></a-input>
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='商品'
                              :required='true'
                              >
                              <a-input-search placeholder='请选择商品'
                                              :disabled=!item.productLevelCode
                                              v-model='item.productName'
                                              readOnly enter-button
                                              @search='custSearchPro2("productName",i, item.productLevelCode)' />
                              <a-input type='hidden' v-model='item.productCode'></a-input>
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='申请数量'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入日工资'
                                       v-model='item.applyNum' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='寄送对象'
                              >
                              <a-input :readOnly='true' placeholder='请输入寄送对象' v-model='item.sendObj' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--DM-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 6'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='刊位'
                              >
                              <a-input :readOnly='true' placeholder='请输入刊位' v-model='item.journalPosition' />
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--                      进场费-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 7'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='门店数量'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入门店数量'
                                       v-model='item.terminalNum' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='条码数量'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入条码数量'
                                       v-model='item.barCodeNum' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='单条码金额'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入单条码金额'
                                       v-model='item.singleAmount' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='回报周期'
                              :required='true'
                              >
                              <a-input :readOnly='true' type='number' :min='0' placeholder='请输入回报周期'
                                       v-model='item.returnCycle' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--                      试吃费-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 8'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              label='试吃商品'
                              :required='true'
                              >
                              <a-input-search :readOnly='true' placeholder='请选择试吃商品'
                                              v-model='item.eatProductName'
                                              readOnly enter-button
                                              @search='custSearchPro("eatProductName",i)' />
                              <a-input type='hidden' v-model='item.eatProductCode'></a-input>
                            </a-form-item>
                          </a-col>
                        </a-col>
                        <!--                      场地费-->
                        <a-col :md='24' :sm='24' v-if='item.categoriesDetailType == 11'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :required='true'
                              :wrapperCol='wrapperCol1'
                              label='活动地点'
                              >
                              <a-input :readOnly='true' placeholder='请输入活动地点' v-model='item.actAddress' />
                              <!--                          @change='e => displayFormGet(e,i)'-->
                            </a-form-item>
                          </a-col>
                        </a-col>

                        <!--广宣物料费-->
                        <div style='width:100%' v-if='item.categoriesDetailType == "13"'>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='发货方式'
                              >
                              <a-input :readOnly='true' placeholder='请输入发货方式' v-model='item.deliveryTypeStr' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='活动地点'
                              >
                              <a-input :readOnly='true' placeholder='请输入活动地点' v-model='item.actAddress' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='活动类型'
                              >
                              <a-input :readOnly='true' placeholder='请输入活动类型' v-model='item.actTypeStr' />
                            </a-form-item>
                          </a-col>
                          <a-col :xl='12' :md='24' :sm='24'>
                            <a-form-item
                              :labelCol='labelCol1'
                              :wrapperCol='wrapperCol1'
                              :required='true'
                              label='使用方式'
                              >
                              <a-input :readOnly='true' placeholder='请输入使用方式' v-model='item.useType' />
                            </a-form-item>
                          </a-col>
                        </div>
                        <!--                      支付方式-->
                        <a-col :xl='12' :md='24' :sm='24' v-if='item.categoriesDetailType !== "13"'>
                          <a-form-item
                            :labelCol='labelCol1'
                            :wrapperCol='wrapperCol1'
                            label='支付方式'
                            :required='true'
                            >
                            <a-input :readOnly='true' v-model='item.payTypeStr' />
                          </a-form-item>
                        </a-col>
                        <a-col :xl='12' :md='24' :sm='24' v-if='item.payType == 2 '>
                          <a-form-item
                            :labelCol='labelCol1'
                            :wrapperCol='wrapperCol1'
                            label='商品层级'
                            :required='true'
                            >
                            <a-input :readOnly='true' v-model='item.hbProductLevelName' />
                          </a-form-item>
                        </a-col>
                        <a-col :xl='12' :md='24' :sm='24' v-if='item.payType == 2'>
                          <a-form-item
                            :labelCol='labelCol1'
                            :wrapperCol='wrapperCol1'
                            :required='true'
                            label='货补商品'
                          >
                            <a-input placeholder='请选择商品'
                                     :readOnly='true'
                                     v-model='item.hbProductName'
                                     readOnly enter-button
                                     @search='custSearchPro2("productNamess",i, item.hbProductLevelCode)' />
                            <!--                            <a-input type='hidden' v-model='item.hbProductCode'></a-input>-->
                          </a-form-item>
                        </a-col>
                        <a-col :xl='12' :md='24' :sm='24' v-if='item.payType == 3'>
                          <a-form-item
                            :labelCol='labelCol1'
                            :wrapperCol='wrapperCol1'
                            :required='true'
                            label='税点'
                            >
                            <a-input v-model='item.taxPoint' :readOnly='true' placeholder='请输入税点'></a-input>
                          </a-form-item>
                        </a-col>
                        <!--                      备注区域-->
                        <a-col :md='23' :sm='24'>
                          <a-form-item
                            :labelCol='{xs:4,xm:24}'
                            :wrapperCol='{xs:20,xm:24}'
                            label='说明'
                            >
                            <a-textarea :readOnly='true' placeholder='请输入备注' v-model='item.remarks' />
                          </a-form-item>
                        </a-col>
                      </a-card>
                    </a-tab-pane>
                  </a-tabs>
                </a-spin>
              </div>
              <div class='choose-right'>
                <div class='total-box'>
                  <div class='total-title'>合计信息</div>
                  <div class='box-text'><span>总计申请 : {{ totalData.money || 0 }}</span>
                    <span>活动细类数量 : {{ totalData.number }}</span></div>
                </div>

                <div class='total-box'>
                  <div class='total-title'>核销示例</div>
                  <a-button type='primary' style='width: 130px' @click='watchExample'>点击查看</a-button>
                </div>
                <div class='total-box'>
                  <div class='total-title'>预算申请情况</div>
                  <div>
                    <a-table size='small' bordered :data-source='dataSource2' :columns='columns1'
                             style='margin: 0 auto'>
                      <template slot='applyAmount' slot-scope='t,r,index'>
                        <span v-if='(dataSource1.find(v=>v.budgetCode==r.budgetCode).amount + (dataSourceAmount2 == null ? 0 : dataSourceAmount2.find(v=>v.budgetCode==r.budgetCode).applyAmount))<t' style='color: red'>{{ t }}(已为负数)</span>
                        <span v-else >{{ t }}</span>
                      </template>

                    </a-table>
                  </div>
                </div>
              </div>
            </div>
          </a-col>
        </a-row>
      </a-form>
      <!--      <select-budget-info ref='selectBudgetInfo' @ok='getCallIn'></select-budget-info>-->
      <writeExample ref='writeExample' :unOrDown=false></writeExample>
      <proChose ref='prochoose' v-bind='modalProps' @okbro='okbropro'></proChose>
      <upload-draw ref='modalUpload'></upload-draw>
      <!--      <orgtoTerminal ref='orgtoUser' @ok='saveUserRelation'></orgtoTerminal>-->
    </a-spin>
  </div>
</template>

<script>
let uploadDraw=require('@/views/tmr/payCenter/modules/uploadDraw')
// import uploadDraw from '@/views/tmr/payCenter/modules/uploadDraw'
import orgtoTerminal from '@/views/tmr/costCenter/modules/orgtoTerminal'
import JSelectProduct from '@/components/cn-select-popup/JSelectProduct'
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
import pick from 'lodash.pick'
import JImageUpload from '@/components/cn-form/JImageUpload'
import JTreeSelect from '@/components/cn-form/JTreeSelect'
import JSelectUserByDep from '@/components/cn-select-popup/JSelectUserByDep'
import JSelectTerminalHy from '@/components/cn-select-popup/JSelectTerminalHy'
import proChose from '@comp/cn-components/ProChose'
import { queryDepartTreeList } from '@/api/api'
import { getAction, postAction, deleteAction } from '@/api/manage'
import selectBudgetInfo from '@/views/tmr/tmrComponents/selectBudgetInfo'
import HpayselectCom from '@/components/cn-components/HpayselectCom'
import writeExample from '@/views/tmr/costCenter/modules/writeExample'
import moment from 'moment'

export default {
  name: 'applicationModal',
  components: {
    uploadDraw,
    orgtoTerminal,
    JSelectProduct,
    JImageUpload,
    JTreeSelect,
    JSelectUserByDep,
    JSelectTerminalHy,
    proChose,
    selectBudgetInfo,
    HpayselectCom,
    JMultiSelectTag,
    writeExample
  },
  data() {
    return {
      orgTreeData: [],
      saveButtons: false,
      saveButton: false,
      aTabsLoading: false,
      disableSubmit: false,
      proName: '',
      totalData: {},
      ptQueryParam: {},
      customerList: [],
      actDetails: [],
      detailAmounts: [],
      templateData: {},
      dataSource1: [],
      dataSource2: [],
      dataSourceAmount2: [],
      custList: [],
      name: '',
      terminalName: '',
      terminalCode: '',
      title: '操作',
      visible: false,
      model: {},
      labelCol1: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 8
        }
      },
      wrapperCol1: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 16
        }
      },
      labelCol: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 5
        }
      },
      wrapperCol: {
        xs: {
          span: 24
        }
        ,
        sm: {
          span: 19
        }
      },
      confirmLoading: false,
      loading: false,
      form: this.$form.createForm(this),
      validatorRules: {
        warehouseCode: {
          rules: [{
            required: true, message: '请输入仓库编码!', trigger: 'submit'
          }]
        }
        ,
        warehouseName: {
          rules: [{
            required: true, message: '请输入仓库名称!', trigger: 'submit'
          }]
        }
        ,
        warehouseType: {
          rules: [{
            required: true, message: '请选择类型!', trigger: 'submit'
          }]
        }
        ,
        status: {
          rules: [{
            required: true, message: '请选择状态!', trigger: 'submit'
          }]
        }
      },
      url: {
        add: window._CONFIG['domianTpmURL'] + '/activity/saveOrUpdate',
        applyAct: window._CONFIG['domianTpmURL'] + '/acttemplate/tpmActTemplate/findCategoriesDetailList',
        custumerList: window._CONFIG['domianURL'] + '/customerController/findCustListByOrg',
        treeData: window._CONFIG['domianURL'] + '/cnOrgController/findTreeListByJurisdiction',
        list: window._CONFIG['domianTpmURL'] + '/oaActivity/findOne'
      },
      treeData: [],
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          fixed: 'left',
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '可用余额',
          align: 'center',
          dataIndex: 'amount',
          fixed: 'left',
          width: 120,
          scopedSlots: { customRender: 'amount' }
        },
        // {
        //   title: '历史余额',
        //   align: 'center',
        //   dataIndex: 'historyMoney',
        //   fixed: 'left',
        //   width: 120
        // },
        {
          title: '预算编码',
          align: 'center',
          dataIndex: 'budgetCode'
        },
        {
          title: '预算科目',
          align: 'center',
          dataIndex: 'budgetSubjectsName'
        },
        {
          title: '预算类型',
          align: 'center',
          dataIndex: 'budgetTypeStr'
        },
        {
          title: '对象',
          align: 'center',
          dataIndex: 'budgetOrgName'
        },
        // {
        //   title: '可用余额',
        //   align: 'center',
        //   dataIndex: 'amount'
        // },
        {
          title: '年份',
          align: 'center',
          dataIndex: 'budgetYear'
        },
        {
          title: '季度',
          align: 'center',
          dataIndex: 'budgetQuarter'
        },
        {
          title: '月份',
          align: 'center',
          dataIndex: 'budgetMonth'
        },
        {
          title: '商品层级',
          align: 'center',
          dataIndex: 'productLevelName'
        },
        {
          title: '商品名称',
          align: 'center',
          dataIndex: 'productName'
        }
        // {
        //   title: '操作',
        //   dataIndex: 'action',
        //   align: 'center',
        //   fixed: 'right',
        //   width: 100,
        //   scopedSlots: {
        //     customRender: 'action'
        //   }
        // }
      ],
      columns1: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          fixed: 'left',
          align: 'center',
          customRender: function(t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '预算编码',
          align: 'center',
          dataIndex: 'budgetCode'
        },
        {
          title: '申请金额',
          align: 'center',
          dataIndex: 'applyAmount',
          scopedSlots: {
            customRender: 'applyAmount'
          }
        }

      ],
      terminalData: [],
      fileVoList: []

    }
  },

  methods: {
    handleEdit() {
      this.$refs.modalUpload.edit(this.fileVoList)
      this.$refs.modalUpload.title = '附件列表'
      this.$refs.modalUpload.disableSubmit = true
      this.$refs.modalUpload.url.list = undefined
    },
    browerGo() {
      this.$router.go(-1)
    },
    getOrgTree() {
      if (this.orgTreeData.length > 0) {
        return
      }
      postAction(this.url.treeData, { permflag: 'act_org_jurisdiction_impl' }).then(res => {
        if (res.success) {
          this.orgTreeData = res.result
          console.log(this.orgTreeData)
        } else {
          this.$message.warning(res.message)
        }
      })
    },
    watchTerminal() {
      this.$refs.prochoose.rowKey = 'id'
      this.$refs.prochoose.isorter.actCode = this.model.changeVersion
      this.$refs.prochoose.isorter.ways = 'get'
      let formconfig = [
        {
          key: 'terminalCode',
          label: '终端编码'
        },
        {
          key: 'terminalName',
          label: '终端名称'
        }
      ]
      let tableconfig = {
        columns: [
          {
            title: '序号',
            key: 'rowIndex',
            width: 60,
            align: 'center',
            customRender: function(t, r, index) {
              return parseInt(index) + 1
            }
          },
          {
            title: '终端编码',
            align: 'center',
            dataIndex: 'terminalCode'
          },
          {
            title: '终端名称',
            align: 'center',
            dataIndex: 'terminalName'
          }
        ],
        list: window._CONFIG['domianTpmURL'] + '/oaActivity/findTerminalByActCode',
        multiple: false,
        columW: 30
      }
      this.proName = '终端'
      this.$refs.prochoose.edit(formconfig, tableconfig, 'status', 'status2')
    },
    custChge(e) {
      let lie = this.customerList.find(item => item.erpCode == e)
      this.form.setFieldsValue({
        custName: lie.customerName
      })
      let url = window._CONFIG['domianURL'] + '/oaCnTerminalController/expenseActRequestFindPageList'
      this.$nextTick(() => {
        postAction(url, { custCode: this.form.getFieldValue('custCode') }).then(res => {
          if (res.success) {
            let codes = res.result.records.map(item => {
              return item.terminalName
            })
            this.form.setFieldsValue({
              terminals: codes
            })
            this.terminalData = res.result.records
          } else {
            that.$message.warning(res.message)
          }
        })
      })

    },
    disabledDate(current) {
      return current < moment().startOf('day')
    },
    watchExample(status, status2, codeKey) {
      if (!this.templateData.templateCode) {
        this.$message.info('请先选择活动模板')
        return
      }
      this.$refs.writeExample.rowKey = 'exampleCode'
      this.$refs.writeExample.isorter.actTemplateCode = this.templateData.templateCode
      this.$refs.writeExample.isorter.ways = 'get'
      let formconfig = []
      let tableconfig = {
        columns: [],
        list: window._CONFIG['domianTpmURL'] + '/oaexample/findOne',
        multiple: false,
        columW: 11
      }
      this.proName = '产品'
      this.$refs.writeExample.edit(formconfig, tableconfig, status, status2)
    },
    userlist() {
      if (!this.templateData.templateCode) {
        this.$message.info('请先选择模板')
        return
      }
      if (this.model.actCode) {
        this.templateData.actCode = this.model.actCode
        this.templateData.custCode = this.form.getFieldValue('custCode')
      } else {
        this.templateData.actCode = null
      }
      this.$refs.orgtoUser.showModal(this.templateData)
    },
    saveUserRelation(cord) {
      let codes = cord.users.map(item => {
        return item.terminalName
      })
      this.terminalData = cord.users
      this.form.setFieldsValue({
        terminals: codes
      })
      console.log(cord)
    },
    moneyTotal(e, cord) {
      console.log(e, cord)
      let array = this.actDetails
      let total = 0
      let totalTable = []
      array.forEach(item => {
        item.detailAmounts.forEach(item => {
          let obj = {
            budgetCode: item.budgetCode,
            applyAmount: item.applyAmount,
            budgetOrgName: item.budgetOrgName
          }
          totalTable.push(obj)
          let a = item.applyAmount ? item.applyAmount : 0
          total += (a - 0)
        })
      })
      const dataSource = JSON.parse(JSON.stringify(this.dataSource2))
      console.log(dataSource)
      console.log(totalTable)
      dataSource.forEach(item => {
          item.applyAmount = 0
          totalTable.forEach(items => {
            if (item.budgetCode == items.budgetCode) {
              items.applyAmount ? items.applyAmount = items.applyAmount : items.applyAmount = 0
              item.applyAmount += (items.applyAmount - 0)
            }
          })

        }
      )
      this.dataSource1.forEach(item => {
        item.historyMoney = item.amount - total
      })
      this.$set(this, 'dataSource2', dataSource)
      this.$set(this.totalData, 'money', total)
    },
    copeDataChange() {
      let array = this.actDetails
      let total = 0
      let totalTable = []
      array.forEach(item => {
        item.detailAmounts.forEach(item => {
          let obj = {
            budgetCode: item.budgetCode,
            applyAmount: item.applyAmount,
            budgetOrgName: item.budgetOrgName
          }
          totalTable.push(obj)
          let a = item.applyAmount ? item.applyAmount : 0
          total += (a - 0)
        })
      })
      const dataSource = JSON.parse(JSON.stringify(this.dataSource2))

      dataSource.forEach(item => {
          item.applyAmount = 0
          totalTable.forEach(items => {
            if (item.budgetCode == items.budgetCode) {
              items.applyAmount ? items.applyAmount = items.applyAmount : items.applyAmount = 0
              item.applyAmount += (items.applyAmount - 0)
            }
          })

        }
      )
      this.dataSource1.forEach(item => {
        item.historyMoney = item.amount - total
      })
      this.$set(this, 'dataSource2', dataSource)
      this.$set(this.totalData, 'money', total)
    },
    handleDelect(key) {
      const dataSurces = [...this.dataSource1]
      if (dataSurces.length == 1) {
        this.$message.info('请至少保留一行预算信息')
        return
      }
      this.aTabsLoading = true
      this.dataSource1 = dataSurces.filter(item => item.id !== key)
      let Source = JSON.parse(JSON.stringify(this.dataSource1))
      // this.dataSource1.forEach(item => {
      //   item.historyMoney = 0
      // })
      // this.totalData.money = 0
      this.detailAmounts = Source
      this.dataSource2 = Source
      if (this.actDetails) {
        this.actDetails.forEach(item => {
          let array = item.detailAmounts
          item.detailAmounts = array.filter(item => item.id !== key)
          console.log('items')
        })
      }

      this.copeDataChange()

      setTimeout(() => {
        this.aTabsLoading = false
      }, 300)
    },
    dataChange(e1, i, key) {
      const target = this.actDetails[i]
      if (key == 'employStartDate') {
        target.employStartDate = e1[0].format('YYYY-MM-DD')
        target.employEndDate = e1[1].format('YYYY-MM-DD')
      }
      this.$set(this.actDetails, i, target)
      console.log(this.actDetails)
    },

    custSearchPro2(status, status2, codeKey) {
      this.$refs.prochoose.rowKey = 'matnr'
      this.$refs.prochoose.isorter.typeCode = codeKey
      let formconfig = [
        {
          key: 'matnr',
          label: '产品编码'
        },
        {
          key: 'maktx',
          label: '产品名称'
        }
      ]
      let tableconfig = {
        columns: [
          {
            title: '产品编码',
            align: 'center',
            dataIndex: 'matnr',
            width: 120,
            ellipsis: true
          },
          {
            title: '产品名称',
            align: 'center',
            dataIndex: 'maktx',
            width: 120,
            ellipsis: true
          }
        ],
        list: window._CONFIG['domianURL'] + '/cnProductController/getProductListByCust',
        multiple: false,
        columW: 11
      }
      this.proName = '产品'
      this.$refs.prochoose.edit(formconfig, tableconfig, status, status2)
    },
    custSearchPro(status, status2) {
      this.$refs.prochoose.rowKey = 'matnr'
      this.$refs.prochoose.isorter.typeCode = undefined
      let formconfig = [
        {
          key: 'matnr',
          label: '产品编码'
        },
        {
          key: 'maktx',
          label: '产品名称'
        }
      ]
      let tableconfig = {
        columns: [
          {
            title: '产品编码',
            align: 'center',
            dataIndex: 'matnr',
            width: 120,
            ellipsis: true
          },
          {
            title: '产品名称',
            align: 'center',
            dataIndex: 'maktx',
            width: 120,
            ellipsis: true
          }
        ],

        list: window._CONFIG['domianURL'] + '/cnProductController/getProductListByCust',
        multiple: false,
        columW: 11
      }
      this.proName = '产品'
      this.$refs.prochoose.edit(formconfig, tableconfig, status, status2)
    },
    selectRole(row, status2) {
      const target = this.actDetails[status2]
      target.displayProductList = row.map(item => {
        let obj = {
          displayProductCode: item.matnr,
          displayProductName: item.maktx
        }
        return obj
      })
      this.$set(this.actDetails, status2, target)
      console.log('8989')
      console.log(this.actDetails)
    },
    changeJselect(name, value, i, key) {
      const target = this.actDetails[i]
      if (key == 'productLevelName') {
        target.productLevelCode = name
        target.productLevelName = value
      }
      if (key == 'hbProductLevelName') {
        target.hbProductLevelCode = name
        target.hbProductLevelName = value
      }
      this.$set(this.actDetails, i, target)
      console.log(this.actDetails)
    },
    handleInput(e, i, key) {
      const target = this.actDetails[i]
      target[key] = e
      this.$set(this.actDetails, i, target)
      console.log(this.actDetails)
    },
    // 根据组织查客户列表
    channelTypeCh(e, key) {
      if (key.dictCode == 'terminal_type') {
        this.form.setFieldsValue({
          channelCode: key.dictDataCode,
          channelName: key.dictDataDesc
        })
      }

      console.log(e, key)
    },
    // orgCodeCh(e, key) {
    //   console.log(e, key)
    //   this.form.setFieldsValue({
    //     actOrgCode: e,
    //     actOrgName: key[0],
    //     custCode: undefined,
    //     custName: undefined,
    //     terminals: undefined
    //   })
    //   getAction(this.url.custumerList, { orgCode: e }).then(res => {
    //     if (res.success) {
    //       console.log(res)
    //       this.customerList = res.result
    //     } else {
    //       this.$message.warning(res.message)
    //     }
    //   })
    // },
    getPayMoney(e) {
      console.log('889')
      console.log(e)
      console.log(this.form.getFieldValue('terminals'))
      console.log('889')
    },
    personChange(e) {
      console.log(e)
    },
    loadTree() {
      var that = this
      queryDepartTreeList().then((res) => {
        if (res.success) {
          that.treeData = []
          let treeList = res.result
          for (let a = 0; a < treeList.length; a++) {
            let temp = treeList[a]
            temp.isLeaf = temp.leaf
            that.treeData.push(temp)
          }
        }
      })
    },

    modalFormOk(e1, e2) {
      console.log(e1, e2)
    },
    add() {
      this.edit({})
    },
    edit(idKey) {
      if (!idKey) {
        this.$message.info('请确认ID是否存在')
        return
      }
      let record = {}

      getAction(this.url.list, { id: idKey }).then(res => {
        if (!res.success) {
          this.$message(res.message)
          return
        }
        this.fileVoList = []
        this.disableSubmit = true
        record = res.result
        this.form.resetFields()
        this.templateData = {}
        this.actDetails = []
        this.saveButton = true
        this.fileVoList = record.fileVoList
        this.model = Object.assign({}, record)
        this.visible = true
        this.dataSource1 = this.model.budgetCodes || []
        if (this.model.actOrgCode) {
          this.dataSource1.forEach(item => {
            item.historyMoney = item.amount - record.totalAmount
          })
        }

        this.$nextTick(() => {
          this.form.setFieldsValue(pick(this.model, Object.keys(this.model)))
          this.form.setFieldsValue({ rangDate: [this.model.startDate, this.model.endDate] })
          this.form.setFieldsValue({
            custCode: record.custCode,
            custName: record.custName
          })
          this.actDetails = record.actDetails
          this.templateData = {
            actScopeType: this.model.actScopeType,
            templateName: this.model.templateName,
            templateCode: this.model.templateCode
          }
          this.totalData.money = this.model.totalAmount
          this.dataSource2 = this.model.totalVos
          this.dataSourceAmount2 = this.model.totalVos
        })
      })
    },
    close() {
      this.visible = false
    },
    okbropro(record, status, status2, status3) {
      console.log(record, status, status2, status3)
      if (status == 'customerCode') {
        this.form.setFieldsValue({
          customerCode: record[0].customerCode,
          customerName: record[0].customerName
        })
      } else if (status == 'copyV') {
        this.templateData = Object.assign({}, record[0])
        getAction(this.url.applyAct, { templateCode: this.templateData.templateCode }).then(res => {
          if (res.success) {
            // console.log(res)
            this.actDetails = []
            this.actDetails = res.result
            this.actDetails.forEach(item => {
              item.detailAmounts = JSON.parse(JSON.stringify(this.dataSource1))
            })
            this.totalData.number = this.actDetails.length
            this.totalData.money = 0
            const dataSource2 = this.dataSource2
            dataSource2.forEach(item => {
              item.applyAmount = 0
            })

            console.log(this.detailAmounts)

          } else {
            this.$message.warning(res.message)
          }
        })
        this.dataSource1.forEach(item => {
          item.historyMoney = 0
        })
      } else if (status == 'product') {
        const target = this.actDetails[status2]
        target.displayProductName = record[0].maktx
        target.displayProductCode = record[0].matnr
        this.$set(this.actDetails, status2, target)
      } else if (status == 'eatProductName') {
        const target = this.actDetails[status2]
        target.eatProductName = record[0].maktx
        target.eatProductCode = record[0].matnr
        this.$set(this.actDetails, status2, target)
      } else if (status == 'productName') {
        const target = this.actDetails[status2]
        target.productName = record[0].maktx
        target.productCode = record[0].matnr
        this.$set(this.actDetails, status2, target)
      } else if (status == 'productNamess') {
        const target = this.actDetails[status2]
        target.hbProductName = record[0].maktx
        target.hbProductCode = record[0].matnr
        this.$set(this.actDetails, status2, target)
      }
    },
    custOrgCodeSearch(status) {
      if (!this.dataSource1 || this.dataSource1.length == 0) {
        this.$message.info('请先选择预算信息')
        return
      }
      this.$refs.prochoose.rowKey = 'id'
      this.$refs.prochoose.isorter = {
        subjectList: this.dataSource1.map(item => {
          return item.budgetSubjectsCode
        })
      }
      let formconfig = [
        {
          key: 'templateCode',
          label: '活动模版编号'
        },
        {
          key: 'templateName',
          label: '活动模版名称'
        }

      ]
      let tableconfig = {
        columns: [
          {
            title: '活动模版编号',
            align: 'left',
            width: 120,
            dataIndex: 'templateCode'
          },
          {
            title: '活动模版名称',
            align: 'left',
            dataIndex: 'templateName',
            width: 120
          },
          {
            title: '关联预算科目',
            align: 'left',
            dataIndex: 'budgetSubjectsName',
            width: 120
            // customRender: (t, r) => {
            //   let list = r.subjectVoList.map(v => v.budgetSubjectsName)
            //   return list + ''
            // }
          }
        ],
        list: window._CONFIG['domianTpmURL'] + '/acttemplate/tpmActTemplate/findPageListActivity',
        multiple: false,
        columW: 10
      }
      this.name = '活动模板'
      this.$refs.prochoose.edit(formconfig, tableconfig, status, 'superName')
    },
    personSearch(status) {
      this.$refs.prochoose.rowKey = 'id'
      let formconfig = [
        {
          key: 'realname',
          label: '用户账户'
        },
        {
          key: 'username',
          label: '用户名称'
        }
      ]
      let tableconfig = {
        columns: [
          {
            title: '用户账户',
            align: 'left',
            dataIndex: 'realname',
            width: 120,
            ellipsis: true
          },
          {
            title: '用户名称',
            align: 'left',
            dataIndex: 'username',
            width: 120,
            ellipsis: true
          }
        ],
        list: window._CONFIG['domianURL'] + '/cnUserController/findEnterpriseUsersPageList',
        multiple: false,
        columW: 10
      }
      this.name = '用户'
      let dataSource = []
      if (this.form.getFieldValue('username')) {
        dataSource = [{
          username: this.form.getFieldValue('username'),
          realname: this.form.getFieldValue('realname')
        }]
      }
      console.log(dataSource)
      this.$refs.prochoose.edit(formconfig, tableconfig, status, 'realname', dataSource)
    },
    custSearch(status = 'customerCode') {

      this.$refs.prochoose.rowKey = 'customerCode'
      let formconfig = [
        {
          key: 'customerCode',
          label: '经销商编码'
        },
        {
          key: 'customerName',
          label: '经销商名称'
        }
      ]
      let tableconfig = {
        columns: [
          {
            title: '经销商编码',
            align: 'center',
            dataIndex: 'customerCode',
            width: 120,
            ellipsis: true
          },
          {
            title: '经销商名称',
            align: 'center',
            dataIndex: 'customerName',
            width: 120,
            ellipsis: true
          }
        ],
        list: window._CONFIG['domianURL'] + '/customerController/getPageList',
        multiple: false,
        columW: 11
      }
      // let dataSource = []
      // if (this.form.getFieldValue('custCode')) {
      //   dataSource = [{
      //     custCode: this.form.getFieldValue('custCode'),
      //     custName: this.form.getFieldValue('custName')
      //   }]
      // }
      this.name = '经销商'
      this.$refs.prochoose.edit(formconfig, tableconfig, status, 'status2', null)
    },
    moment,
    handleOk(status) {
      const that = this
      // 触发表单验证
      this.form.validateFields((err, values) => {
        console.log(this.actDetails)
        let arrayCode = 'fine'
        this.actDetails.some(item => {
          if (item.categoriesDetailType == 1) {
            if (!item.displayForm || item.displayForm === ' ' || !item.displayProductCode || item.displayProductCode === ' ' || !item.displayPosition || item.displayPosition === ' ') {
              this.$message.info('请检查陈列费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 3) {
            if (!item.manNature || item.manNature === ' ' || item.num == null || item.num === ' ' || item.num == null || item.dailyWage === ' ' || !item.employDay || item.employDay === ' ') {
              this.$message.info('请检查人员费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 4) {
            if (!item.productLevelCode || item.productLevelCode === ' ' || !item.productCode || item.productCode === ' ' || !item.applyNum || item.applyNum === ' ' || !item.sendObj || item.sendObj === ' ') {
              this.$message.info('请检查样品费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 6) {
            if (!item.journalPosition || item.journalPosition === ' ') {
              this.$message.info('请检查DM刊费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 7) {
            if (!item.terminalNum || item.terminalNum === ' ' || !item.barCodeNum || item.barCodeNum === ' ' || !item.singleAmount || item.singleAmount === ' ' || !item.returnCycle || item.returnCycle === ' ') {
              this.$message.info('请检查进场费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 8) {
            if (!item.eatProductCode || item.eatProductCode === ' ') {
              this.$message.info('请检查试吃费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
          if (item.categoriesDetailType == 11) {
            if (!item.actAddress || item.actAddress === ' ') {
              this.$message.info('请检查场地费信息是否填写完整')
              arrayCode = 'bad'
            }
            return true
          }
        })
        console.log(arrayCode)
        if (arrayCode == 'bad') {
          return
        }
        console.log('888')
        if (!err) {
          // that.confirmLoading = true
          let formData = Object.assign({}, this.model, this.templateData, values)
          console.log(formData)
          if (formData.rangDate[0]._d) {
            formData.startDate = formData.rangDate[0].format('YYYY-MM-DD')
            formData.endDate = formData.rangDate[1].format('YYYY-MM-DD')
          }
          formData.terminals = this.terminalData
          formData.budgetCodes = this.dataSource1.map(item => {
            return item.budgetCode
          })
          formData.bpmStatus = status
          formData.actDetails = this.actDetails
          if (!this.model.id) {
            delete formData.id
          } else {
            formData.id = this.model.id
          }
          this.saveButtons = true
          postAction(this.url.add, formData).then((res) => {
            if (res.success) {
              that.$message.success(res.message)
              that.$emit('ok')
              that.close()
            } else {
              that.$message.warning(res.message)
            }
          }).finally(() => {
            that.confirmLoading = false
            this.saveButtons = false
          })
        }
      })
    },
    handleCancel() {
      this.close()
    },
    handlebuget() {
      let date = this.form.getFieldValue('rangDate')
      console.log(date)
      if (!date[0]) {
        this.$message.warning('请选择活动开始时间')
        return
      }
      // this.$refs.selectBudgetInfo.queryParam['id']=this.model.id
      this.$refs.selectBudgetInfo.url.list = window._CONFIG['domianTpmURL'] + '/budget/tpmBudgetFee/findPageListByTime'
      this.$refs.selectBudgetInfo.multiple = true
      this.$refs.selectBudgetInfo.queryParam.permflag = 'tpm_act_add_impl',
        this.$refs.selectBudgetInfo.queryParam.queryStartDate = moment(date[0]).format('YYYY-MM-DD')
      this.$refs.selectBudgetInfo.edit()
      this.$refs.selectBudgetInfo.disableSubmit = false

    },
    getCallIn(e1, e2) {
      console.log(e1, e2)
      this.aTabsLoading = true
      this.dataSource1 = JSON.parse(JSON.stringify(e2))
      this.dataSource1.forEach(item => {
        item.historyMoney = 0
      })
      this.totalData.money = 0
      this.detailAmounts = e2 || []
      this.dataSource2 = e2 || []
      if (this.actDetails) {
        this.actDetails.forEach(item => {
          item.detailAmounts = JSON.parse(JSON.stringify(this.detailAmounts))
          console.log('items')
        })
      }
      setTimeout(() => {
        this.aTabsLoading = false
      }, 300)
    }
  },
  created() {
    let key = location.search.replace('?id=', '')
    this.edit(key)

  },
  computed: {
    modalProps() {
      return Object.assign({}, {
        name: this.proName
      })
    },
    configw() {
      return {
        title: '新增发票信息',
        width: '40%',
        config: {
          list: [
            {
              label: '客户名称',
              type: 'input',
              disabled: true,
              placeholder: '请输入路由ID',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '上账科目编码',
              type: 'input',
              placeholder: '请输入上账科目编码',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '发票编码',
              type: 'input',
              placeholder: '请输入发票编码',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '税码',
              type: 'input',
              placeholder: '请输入税码',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '发票金额',
              type: 'input',
              placeholder: '请输入发票金额(不含税)',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '发票金额',
              type: 'input',
              placeholder: '请输入发票金额(含税)',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '税金',
              type: 'input',
              placeholder: '请输入税金',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: 'ERP成本中心',
              type: 'input',
              placeholder: '请输入ERP成本中心',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            },
            {
              label: '摘要',
              type: 'input',
              placeholder: '请输入摘要',
              name: 'routeId',
              check: { rules: [{ required: true, message: '请输入' }] }
            }
          ]
        }
      }
    }
  }
}
</script>

<style lang='less' scoped>
.oaFeeapply {
  min-width: 800px;
  over-flow: auto;
}

.drawer-bootom-button {
  position: absolute;
  bottom: -8px;
  width: 100%;
  border-top: 1px solid #e8e8e8;
  padding: 10px 16px;
  text-align: right;
  left: 0;
  background: #fff;
  border-radius: 0 0 2px 2px;
}

.basicNew {
  padding: 8px 6px 8px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid #dcdfe6;
  border-top: 1px solid #dcdfe6;
  font-size: 16px;
  font-weight: 700;
}

.basicNew1 {
  margin: 12px;
  padding: 8px 6px 8px 0;
  border-bottom: 1px solid #dcdfe6;
  border-top: 1px solid #dcdfe6;
  font-size: 16px;
  font-weight: 700;
}

.addIcon {
  margin-top: 4px;
  float: right;
  cursor: pointer;
  margin-left: 8px;
  width: 35px;
  height: 30px;
  text-align: center;
  line-height: 25px;
  background-color: #4d80be;
  color: white;
  border-radius: 50%;
  font-size: 20px;
}

.chooseActive {
  width: 100%;
  background-color: #f8f8f8;
  border-top-right-radius: 10px;
  border-top-left-radius: 10px;
  min-height: 100px;
  padding: 12px 10px;
}

.chooseActive1 {
  display: flex;
  width: 100%;
  background-color: #f8f8f8;
  border-bottom-right-radius: 10px;
  border-bottom-left-radius: 10px;
  min-height: 100px;
  padding: 12px 10px;

}

.choose-left {
  overflow: auto;
  flex: 1;
  padding: 4px;
}

.tab-card {
  padding: 8px;
  width: 100%;
  min-height: 100px;
}

.total-box {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.total-title {
  margin-bottom: 12px;
  font-weight: 700;
  font-size: 16px;
}

.box-text {
  display: flex;
  justify-content: space-between;
}

.choose-right {
  padding: 8px;
  flex: 1;
  border-left: 1px solid;
}

/deep/ .ant-select-tree {
  height: 200px !important;
  z-index: 9999;
}
</style>